Component({
  behaviors: [],
  properties: {
    video_position: { value: 0, type: Number },
    goodsData: {
      value: {},
      type: Object,
      observer: function (e) {
        if (
          (console.log('components/banners/banners', e),
          (e && e.imgs.length) || (e.video && this.data.video_position))
        ) {
          var t = 0;
          e.imgs.length && (t += e.imgs.length),
            e.video && this.data.video_position && (t += 1),
            this.setData({
              _imgList: e.imgs,
              _videoList: [e.video],
              _needDownAllTimes: t,
              _needDownTimes_img: e.imgs.length,
              _needDownTimes_video: 1,
            });
        }
      },
    },
  },
  data: {
    bannerImgs: [],
    thumbWidth: 150,
    nowSwiperIndex: 1,
    banner_auto_play: 0,
    fullScreen: !1,
    banner_auto_flag: !1,
    _org_banner_auto_flag: !1,
  },
  lifetimes: {
    ready: function () {
      var e = this;
      this.timer = setTimeout(function () {
        var t = wx.getStorageSync('initSystem');
        e.setData({
          thumbWidth: 750,
          banner_auto_flag: Boolean(+t.banner_auto_play),
          _org_banner_auto_flag: Boolean(+t.banner_auto_play),
          banner_auto_play: t ? 1e3 * +t.banner_auto_play : 2e3,
        });
      }, 3300);
    },
    detached: function () {
      clearTimeout(this.timer);
    },
  },
  methods: {
    bindfullscreenchange: function (e) {
      e.detail.fullScreen
        ? (console.log('进入全屏'), this.setData({ fullScreen: !0 }))
        : (console.log('退出全屏'), this.setData({ fullScreen: !1 }));
    },
    downOver: function () {
      console.log(111);
      var e = this.data.goodsData,
        t = e.imgs,
        a = e.video,
        n = 0;
      t.length && (n += t.length),
        a && this.data.video_position && (n += 1),
        this.setData({
          _imgList: t,
          _videoList: [a],
          _needDownAllTimes: n,
          _needDownTimes_img: t.length,
          _needDownTimes_video: 1,
        });
    },
    _swiperChange: function (e) {
      this.setData({ nowSwiperIndex: e.detail.current + 1 });
      var t = this.properties.goodsData;
      if (t && t.video) {
        e.detail.current;
        wx.createVideoContext('video', this).pause();
      }
    },
    _videoPlay: function (e) {
      this.data._org_banner_auto_flag && this.setData({ banner_auto_flag: !1 });
    },
    _videoStop: function (e) {
      this.data._org_banner_auto_flag && this.setData({ banner_auto_flag: !0 });
    },
    _checkImg: function (e) {
      var t = this.properties.goodsData.imgs,
        a = e.currentTarget.dataset.src;
      wx.previewImage({ current: a, urls: t });
    },
  },
});
